/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HoangHai
 */
@Entity
@Table(name = "Curriculum")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Curriculum.findAll", query = "SELECT c FROM Curriculum c"),
    @NamedQuery(name = "Curriculum.findByCuID", query = "SELECT c FROM Curriculum c WHERE c.cuID = :cuID"),
    @NamedQuery(name = "Curriculum.findByCuName", query = "SELECT c FROM Curriculum c WHERE c.cuName = :cuName"),
    @NamedQuery(name = "Curriculum.findByCuDesc", query = "SELECT c FROM Curriculum c WHERE c.cuDesc = :cuDesc")})
public class Curriculum implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Basic(optional = false)
    //@NotNull
    @Column(name = "CuID")
    private Integer cuID;
    @Size(max = 50)
    @Column(name = "CuName")
    private String cuName;
    @Size(max = 1073741823)
    @Column(name = "CuDesc")
    private String cuDesc;
    @OneToMany(mappedBy = "cuID")
    private List<Semester> semesterList;

    public Curriculum() {
    }

    public Curriculum(Integer cuID) {
        this.cuID = cuID;
    }

    public Integer getCuID() {
        return cuID;
    }

    public void setCuID(Integer cuID) {
        this.cuID = cuID;
    }

    public String getCuName() {
        return cuName;
    }

    public void setCuName(String cuName) {
        this.cuName = cuName;
    }

    public String getCuDesc() {
        return cuDesc;
    }

    public void setCuDesc(String cuDesc) {
        this.cuDesc = cuDesc;
    }

    @XmlTransient
    public List<Semester> getSemesterList() {
        return semesterList;
    }

    public void setSemesterList(List<Semester> semesterList) {
        this.semesterList = semesterList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cuID != null ? cuID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Curriculum)) {
            return false;
        }
        Curriculum other = (Curriculum) object;
        if ((this.cuID == null && other.cuID != null) || (this.cuID != null && !this.cuID.equals(other.cuID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Curriculum[ cuID=" + cuID + " ]";
    }
    
}
